Skip to content

Automated Test: localization-system-post #331

Closed

Conversation

admin-coderabbit
Copy link
Owner

@admin-coderabbit admin-coderabbit commented Feb 4, 2026

This pull request was automatically created by @coderabbitai/e2e-reviewer.

Batch created pull request.

Summary by CodeRabbit

  • Improvements
    • Redesigned translation fallback system for more robust multi-language support. Missing translations now intelligently cascade through a prioritized language chain (current language → site default → English), ensuring consistent behavior. Optimized locale loading across all deployment environments for better internationalization reliability.

The FallbackLocaleList object tells I18n::Backend::Fallbacks what order the
languages should be attempted in. Because of the translate_accelerator patch,
the SiteSetting.default_locale is *not* guaranteed to be fully loaded after the
server starts, so a call to ensure_loaded! is added after the locale is set for
the current user.

The declarations of config.i18n.fallbacks = true in the environment files were
actually garbage, because the I18n.default_locale was
SiteSetting.default_locale, so there was nothing to fall back to. *derp*
@coderabbit-eval
Copy link

coderabbit-eval bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This change replaces global I18n fallbacks configuration with a runtime-based custom fallback strategy. The hardcoded config.i18n.fallbacks = true settings are removed from environment files and replaced with a new FallbackLocaleList class that implements per-locale fallback chains. Locale data is loaded on-demand via the ensure_loaded! method.

Changes

Cohort / File(s) Summary
Configuration Removal
config/environments/production.rb, config/cloud/cloud66/files/production.rb, config/environments/profile.rb
Removed explicit config.i18n.fallbacks = true configuration blocks from environment files, eliminating global fallback behavior configuration at the Rails level.
I18n Initialization
config/initializers/i18n.rb
Introduced new FallbackLocaleList class to customize fallback chains with strategy: [locale, SiteSetting.default_locale, :en]. Added ensure_loaded! method for eager loading of locale fallbacks.
Controller Integration
app/controllers/application_controller.rb
Added call to I18n.fallbacks.ensure_loaded! in set_locale method to load locale fallbacks at runtime when setting user locale.
Backend Updates
lib/freedom_patches/translate_accelerator.rb
Added public ensure_loaded!(locale) method to I18n module singleton class to enable explicit locale pre-loading on demand.
Pluralization Backend
config/initializers/pluralization.rb
Removed pluralization backend loading and inclusion into Simple backend, consolidating internationalization setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Fallbacks now dance at runtime's call,
No static config rules them all,
Each locale knows its heritage chain,
Loading just-in-time, efficient and sane!
I18n learns to breathe, leap, and bound,
Where custom fallback strategies abound. 🌍✨

🚥 Pre-merge checks | ✅ 1 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Automated Test: localization-system-post' is vague and non-descriptive, using generic terminology that does not convey meaningful information about the actual changeset. Provide a more specific title that describes the actual changes, such as 'Refactor I18n fallback configuration and locale loading' or similar language that reflects the core modifications.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch localization-system-post

Comment @coderabbit eval help to get the list of available commands and usage tips.

@coderabbit-eval coderabbit-eval bot closed this Feb 4, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant